from django.urls import path,include
from django.conf.urls import url
from web.views import account,home,project,wiki,file,issues,setting
from web.views import projectManage

app_name = 'web'

urlpatterns = [
    path('',account.hello,name='hello'),
    path('register/',account.register,name='register'),
    path('login/sms/',account.login_sms,name='login_sms'),
    path('login/',account.login,name='login'),    
    path('image/code/',account.image_code,name='image_code'),
    path('send/sms/',account.send_sms,name='send_sms'),
    path('index/',home.index,name='index'),

    path("logout/",account.logout, name="logout"),
    # 项目列表
    path('project/list/',project.project_list,name='project_list'),
    # /project/star/my/1
    # /project/star/join/2
    #path('project/star/(?P<project_type>\w+)/(?P<project_id>)\d+/',project.project_star,name='project_star'),
    #path('project/unstar/(<project_type>)/(?P<project_id>)\d+/',project.project_unstar,name='project_unstar'),
    url(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    url(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar, name='project_unstar'),

    # 项目管理 
    url(r'^manage/(?P<project_id>\d+)/',include([
        url(r'^dashboard/$',projectManage.dashboard, name='dashboard'),
        
        url(r'^statistics/$',projectManage.statistics, name='statistics'),
        

        url(r'^wiki/$',wiki.wiki, name='wiki'),
        url(r'^wiki/add/$',wiki.wiki_add, name='wiki_add'),
        url(r'^wiki/catalog/$',wiki.wiki_catalog, name='wiki_catalog'),
        url(r'^wiki/delete/(?P<wiki_id>\d+)/$', wiki.wiki_delete, name='wiki_delete'),
        url(r'^wiki/edit/(?P<wiki_id>\d+)/$', wiki.wiki_edit, name='wiki_edit'),
        url(r'^wiki/upload/$',wiki.wiki_upload, name='wiki_upload'),

        url(r'^file/$',file.file, name='file'),
        url(r'^file/delete/$',file.file_delete, name='file_delete'),
        url(r'^cos/credential/$',file.cos_credential, name='cos_credential'),
        url(r'^file/post/$',file.file_post, name='file_post'),
        url(r'^file/download/(?P<file_id>\d+)/$',file.file_download, name='file_download'),
        

        url(r'^issues/$',issues.issues, name='issues'),

        url(r'^setting/$',setting.setting, name='setting'),
        url(r'^setting/delete/$',setting.setting_delete, name='setting_delete'),
    ], None)),
]

